<?php
/**
 * Created by PhpStorm.
 * User: Fedax
 * Date: 2018/7/16
 * Time: 22:36
 */

namespace app\admin\controller;

use app\admin\model\Recharge as RechargeModel;
use app\admin\model\User;

class Recharge extends Index
{
    public function rechargeIndex()
    {
        // $rechargeModel = new RechargeModel();
        //$data = $rechargeModel->recharge();
        // return view()->assign('rechargeData',$data);
        return view();
    }

    public function agentRechargeIndex()
    {
        return view();
    }

    public function agentRechargeIndexData()
    {
        $rechargeModel = new RechargeModel();
        $data = $rechargeModel->agentRechargeRecord();

        return json($data);
    }

    /**
     * @return array
     * @user 帅帅吴
     * @date 2018/12/20
     * @time 17:05
     * @title 充值数据
     */
    public function rechargeCount()
    {
        $rechargeModel = new RechargeModel();
        $data = $rechargeModel->rechargeCount();

        return $data;
    }

    /**
     * Notes: 充值记录
     * User: 王俊成
     * Date: 2018/10/29
     * Time: 17:10
     *
     * @return \think\response\Json
     */
    public function rechargeIndexData()
    {
        $rechargeModel = new RechargeModel();
        $data = $rechargeModel->rechargeData();

        return json($data);
    }

    /**
     * Notes: 查询的充值金额
     * User: 王俊成
     * Date: 2018/10/30
     * Time: 14:14
     */
    public function rechargeCountData()
    {
        $rechargeModel = new RechargeModel();
        $data = $rechargeModel->rechargeCountData();

        return json($data);
    }

    /**
     * Notes: 导出充值记录数据
     * User: 王俊成
     * Date: 2018/10/29
     * Time: 17:41
     */
    public function rechargeDataExport()
    {
        $rechargeModel = new RechargeModel();
        $rechargeModel->rechargeDataExport();
    }

    /**
     * Notes: 查询某个用户的充值记录
     * User: 王俊成
     * Date: 2018/11/5
     * Time: 14:27
     *
     * @return $this
     */
    public function rechargeInfo()
    {
        $rechargeModel = new RechargeModel();
        $data = $rechargeModel->rechargeInfo();

        return view()->assign('data', $data);
    }

    //充值信息修改
    public function rechargeEdit()
    {
        $order_no = input('order_no');
        $rechargeModel = new RechargeModel();
        $data = $rechargeModel->where('order_no', $order_no)->find();
        $data['u_id'] = User::where('id', $data['user_id'])->value('u_id');

        return view()->assign('data', $data);
    }

    //充值修改提交
    public function RechargeEditData()
    {
        $rechargeModel = new RechargeModel();
        $res = $rechargeModel->RechargeEditData();

        return $res;
    }

    //充错用户,改变充值用户记录信息
    public function changeRechargeObject()
    {
        return view();
    }

    //充值修改的数据
    public function changeRechargeObjectData()
    {
        $rechargeModel = new RechargeModel();
        $data = $rechargeModel->changeRechargeObject();

        return json($data);
    }
}
